package com.gitee.neuray.security.par.parworkclock.biz;

import com.gitee.neuray.security.common.biz.BaseBiz;
import com.gitee.neuray.security.common.msg.TableResultResponse;
import com.gitee.neuray.security.common.util.Query;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import org.springframework.transaction.annotation.Transactional;

import com.gitee.neuray.security.par.parworkclock.mapper.ParworkclockMapper;
import com.gitee.neuray.security.par.parworkclock.vo.ParworkclockVo;


@Service
@Transactional(rollbackFor = Exception.class)
public class ParworkclockBiz extends BaseBiz<ParworkclockMapper,ParworkclockVo> {
    @Autowired
    private ParworkclockMapper parworkclockMapper;

    /**
    * 分页获取信息
    * @param query
    * @return
    */
    public TableResultResponse page(Query query){
        Page<Object> result = PageHelper.startPage(query.getPageNo(), query.getPageSize());
        List<ParworkclockVo> list = parworkclockMapper.page(query);
        return new TableResultResponse(result.getPageSize(),result.getPageNum(),result.getPages(),result.getTotal(),list);
    }

    public TableResultResponse list(Query query){
        Page<Object> result = PageHelper.startPage(query.getPageNo(), query.getPageSize());
        List<ParworkclockVo> list = parworkclockMapper.list(query);
        return new TableResultResponse(result.getPageSize(),result.getPageNum(),result.getPages(),result.getTotal(),list);
    }
    /**
    * 导出无分页
    * @param query
    * @return
    */
    public List<ParworkclockVo> nopage(Query query) {
        return parworkclockMapper.page(query);
    }

    @Override
    protected String getPageName() {
        return null;
    }
}
